<?php

class App_Helper_Menu_MenuItem {
   
   public $title;
   public $link;
   public $show;
   public $class;
   public $menu;
   public $wrapElem = 'li';
   public $subMenuContainerClass;
   public $subMenuItems;
   public $wrap;
   
   public function __construct($title, $link=null, $show=true, $menuItemClass='', $subMenuContainerClass='links', $wrap=true) {
      $this->title = $title;
      $this->link = $link;
      $this->show = $show;
      $this->menuItemClass = $menuItemClass;
      $this->subMenuContainerClass = $subMenuContainerClass;
      $this->wrap = $wrap;
   }
   public function setWrapElement($name) {
      $this->wrapElem = $name;
   }
   
   public function __toString() {
      $view = Zend_Layout::getMvcInstance()->getView();      
      $str = "";
      if($this->show) {
         $str = "";
         if($this->wrap) {
            $str .= '<' . $this->wrapElem . ($this->menuItemClass ? ' class="' . $this->menuItemClass . '"' : '') . 
            '>';
         }
         $str .= '<a href="' . $this->link . '">' . $view->translate->_($this->title) . '</a>';
         if($this->wrap) {
            $str .= '</' . $this->wrapElem . '>';
         }
      }
      
      return $str;
   }
}